package data 
{
	import ru.gosoplata.model.TmpModel;
	/**
	 * TODO: WCData переделать в VO
	 */
	public class WCData 
	{
		public var DOORNUM:Number;
		public var PAYED:Boolean = false;
		
		private var _stats:Array = [2,2];
		
		public function WCData() 
		{
		}

		public function get availabel():Boolean 
		{
			return left == 0 || right == 0;
		}
		
		public function parseStatus(str:String):void 
		{
			if (str.indexOf(";")==-1) {
				_stats = [2,2];
			}else{
				_stats = str.split(";", 3);
				_stats.shift();
			}
			if (TmpModel.config.req.params.row.@wc_block_1 == '1')_stats[0] = 1;
			if (TmpModel.config.req.params.row.@wc_block_2 == '1')_stats[1] = 1;
			TmpModel.debugOutput.add("WCData status: "+left+" "+right+" (availabel:"+availabel+",free:"+getFreeDoor()+") " );
		}
		
		public function getFreeDoor():uint 
		{
			if (!left && !right) return Math.round(1 + Math.random());
			if (!left) return 1;
			if (!right) return 2;
			return 0;
		}
		
		public function get left():uint 
		{
			return _stats[0];
		}
		
		public function get right():uint 
		{
			return _stats[1];
		}
	}
}